{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-input-inline layui-form">
                            <select name="type" lay-search="">
                                <option  value="">不限状态</option>
                                <option  value="1">未加工</option>
                                <option  value="2">加工中</option>
                                <option  value="3">已加工</option>
                            </select>
                        </div>
                        <div class="layui-input-inline layui-form">
                            <select name="number" lay-search="">
                                <option  value="">不限终端编号 名称</option>
                                {foreach name="$data" item="vo"}
                                <option  value="{$vo.m_id}">{$vo.m_serial} {$vo.m_name}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline" style="width:350px;">
                            <input type="text" class="layui-input search" name="key" placeholder="客户名称/工单名称"/>
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
                <!--操作框开始-->
                <div class="col-sm-12">
                    <div class="input-group" >
                        <button class="btn btn-primary" type="button" onclick="wk.href('{:url('orderAdd')}');">
                            <i class="fa fa-plus"></i> 创建工单
                        </button>
                    </div>
                </div>
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <script type="text/html" id="staTpl">
                        {{# switch(d.p_status){case 1: }}
                            {{d.p_num}}{{d.p_name}}:<span style="color:#CD3A3A;">未加工</span>
                        {{# break; case 2: }}
                            {{d.p_num}}{{d.p_name}}:<span style="color:#2E76E4;">加工中</span>
                        {{# break; case 3: }}
                            {{d.p_num}}{{d.p_name}}:<span style="color:#272727;">已完工</span>({{d.p_finish_name}})
                        {{# break; } }}
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        {{# switch(d.w_type){case 1: }}
                        <a href="javascript:;" onclick="wk.pack_download('{{d.w_content}}');" class="btn btn-primary btn-xs m-r-xs" title="{{d.w_content}}"><i class="fa fa-download"></i></a>
                        {{# break;case 2: }}
                        <a href="{{d.w_content}}" class="btn btn-primary btn-xs m-r-xs" title="{{d.w_content}}"><i class="fa fa-download"></i></a>
                        {{# break;case 3: }}
                        <a href="{{d.w_content}}" class="btn btn-primary btn-xs m-r-xs" download title="{{d.w_content}}"><i class="fa fa-download"></i></a>
                        {{# break;} }}
                        {{# if(d.p_status != 3){ }}
                        <a href="javascript:;" onclick="wk.href('{:url('orderEdit')}?id={{d.w_id}}')" class="btn btn-primary btn-xs m-r-xs" title="继续发送"><i class="fa fa-pencil"></i></a>
                        {{# } }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.w_id}}','{:url('orderDel')}')" class="btn btn-danger btn-xs m-r-xs" title="删除"><i class="fa fa-trash-o"></i></a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Order/workOrder")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {field: 'w_id', width: 90, title: '编号', align: 'center'}
                , {field: 'w_server_name', width: '', title: '客户名称', align: 'center'}
                , {field: 'w_work_name', width: '', title: '工单名称', align: 'center'}
                , {field: 'p_status',width: '', title: '加工状态', align: 'center', templet:"#staTpl"}
                , {field: 'w_create_time', width: '', title: '创建时间', align: 'center'}
                , {fixed: 'right', width: 200, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
        });
    });
</script>
</body>
</html>